#include <iostream>
using namespace std;

int binarySearch(const int *arr, const int &n, const int &key) {
    int left = 0;
    int right = n;
    int mid;
    while (left < right) {
        mid = (right + left) / 2;
        if (key == arr[mid]) return 1;
        if (key > arr[mid]) left = mid + 1;
        else if (key < arr[mid]) right = mid;
    }
    return 0;
}

int main() {
    int i, q, k, sum = 0, n;
    cin >> n;
    int A[10000];
    for (i = 0; i < n; ++i) cin >> A[i];
    cin >> q;
    for (i = 0; i < q; ++i) {
        cin >> k;
        if (binarySearch(A, n, k)) ++sum;
    }
    cout << sum << endl;
    return 0;
}